home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / c / ExtrasLib.lha / ExtrasLib / Source / EzReqs.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-30  |  3.0 KB  |  113 lines

  1. #include <clib/extras_protos.h>
  2. #include <clib/extras/intuition_protos.h>
  3. #include <proto/exec.h>
  4. #include <proto/intuition.h>
  5.  
  6. //struct FontRequester *ML_FontReq;
  7. /****** extras.lib/EZReq ******************************************
  8. *
  9. *   NAME
  10. *       EZReq -- create an Intuition EasyRequest.
  11. *
  12. *   SYNOPSIS
  13. *       retval = EZReq(Win, IDCMP_ptr, Title, Text,
  14. *                       ButtonText,Arg,...)
  15. *
  16. *       LONG EZReq(struct Window *, ULONG *, STRPTR, STRPTR, 
  17. *                  STRPTR, ULONG, ...);
  18. *
  19. *   FUNCTION
  20. *       This function provides an easier method to use the 
  21. *       intuition/EasyRequestArgs() function.
  22. *
  23. *   INPUTS
  24. *       Win -
  25. *       IDCMP_ptr - 
  26. *       Title -
  27. *       Text -
  28. *       ButtonText -
  29. *       Arg -
  30. *
  31. *   RESULT
  32. *
  33. *   EXAMPLE
  34. *
  35. *   NOTES
  36. *       requires the exec.library to be open, automatically opens
  37. *       intuition.library.
  38. *
  39. *   BUGS
  40. *
  41. *   SEE ALSO
  42. *
  43. ******************************************************************************
  44. *
  45. */
  46.  
  47. LONG EZReq(struct Window *Win,
  48.            ULONG *IDCMP_ptr,
  49.            STRPTR Title,
  50.            STRPTR Text,
  51.            STRPTR ButtonText,
  52.            ULONG Arg,
  53.            ... )
  54. {
  55.   struct EasyStruct es;    
  56. //  struct IntuitionBase *IntuitionBase;
  57.   LONG  rv;
  58.   
  59. //  if(IntuitionBase=(struct IntuitionBase *)OpenLibrary((UBYTE *)"intuition.library",36))
  60.   {
  61.     es.es_StructSize    =sizeof(struct EasyStruct);
  62.     es.es_Flags         =0;
  63.     es.es_Title         =Title;
  64.     es.es_TextFormat    =Text;
  65.     es.es_GadgetFormat  =ButtonText;
  66.     rv=EasyRequestArgs(Win,&es,IDCMP_ptr,&Arg);
  67. //    CloseLibrary((struct Library *)IntuitionBase);
  68.   }
  69.   return(rv);
  70. }
  71.  
  72. /*
  73. BOOL PickFont(struct Window *w,
  74.               WORD InitLeft,
  75.               WORD InitTop,
  76.               WORD InitWidth,
  77.               WORD InitHeight,
  78.               struct TTextAttr *TA)
  79. {
  80.   if(TA)
  81.   {
  82.     if(!ML_FontReq)
  83.       ML_FontReq=(struct FontRequester *)AllocAslRequestTags(ASL_FontRequest, 
  84.                       ASLFO_InitialTopEdge,  InitTop,
  85.                       ASLFO_InitialLeftEdge, InitLeft,
  86.                       ASLFO_InitialWidth,    InitWidth,
  87.                       ASLFO_InitialHeight,   InitHeight,
  88.                       ASLFO_SleepWindow,     TRUE,
  89.                       ASLFO_TitleText,       FontReqTitle,
  90.                       ASLFO_DoStyle,         TRUE,
  91.                       ASLFO_MinHeight,       1,
  92.                       ASLFO_MaxHeight,       65535,
  93.                       TAG_DONE);
  94.     if(ML_FontReq)
  95.     {
  96.       if(AslRequestTags(ML_FontReq, 
  97.                   ASLFO_Window   ,       w,
  98.                                   TAG_DONE))
  99.       {
  100.         if(TA->tta_Name)  
  101.           FreeVec(TA->tta_Name);
  102.         if(TA->tta_Name=AllocVec(strlen(ML_FontReq->fo_TAttr.tta_Name)+1,MEMF_PUBLIC|MEMF_CLEAR))
  103.           strcpy(TA->tta_Name,ML_FontReq->fo_TAttr.tta_Name);
  104.         TA->tta_YSize = ML_FontReq->fo_TAttr.tta_YSize;
  105.         TA->tta_Style = ML_FontReq->fo_TAttr.tta_Style & (~FSF_TAGGED);
  106.         TA->tta_Flags = ML_FontReq->fo_TAttr.tta_Flags;
  107.         return(TRUE);
  108.       }   
  109.     }
  110.   }
  111.   return(FALSE);
  112. }
  113. */